-
-
Notifications
You must be signed in to change notification settings - Fork 34k
gh-144377: Clean up sqlite3 Connection's list of weakrefs to Cursor objects #144378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f65eac1 to
203cb74
Compare
vstinner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Please remove pycore_weakref.h include.
| Py_ssize_t imax = PyList_GET_SIZE(self->cursors); | ||
| for (Py_ssize_t i = 0; i < imax; i++) { | ||
| PyObject* weakref = PyList_GET_ITEM(self->cursors, i); | ||
| if (_PyWeakref_IsDead(weakref)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the internal _PyWeakref_IsDead() function is no longer used, you can remove #include "pycore_weakref.h".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do, but this made me realise that there's no equivalent function to clean up self->blobs, which otherwise is a parallel of self->cursors. So if you have a long-lived connection object and keep using conn.blobopen(), the list of weakrefs will grow indefinitely.
Is that a problem, or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that a problem, or am I missing something?
If you consider that it's an issue, please open a separated issue. It's not directly related to this change.
|
Merged. Thanks for the cleanup change. |
This cleans up the code for an unused (as far as I can see) list of Cursor weakrefs.
Closes #144377